package com.moarea.app.util;

import java.util.HashMap;

public class AnyFormatDocumentConstant {
	
	public static final String NEW_LINE = "\n";
	public static final String PARAM_INTERVAL = "#_间隔_#";	
	public static final String SIMPLE_MODE = "simpleMode";	
	public static final String STYLE_MODE = "styleMode";	
	
	
	public static final String ROWS_NUM = "#_行数_#";
	public static final String COLS_NUM = "#_列数_#";
	
	
	/**
	 * excel文档
	 */
	public static final String TYPE_XLS = "xls";
	/**
	 * doc文档
	 */
	public static final String TYPE_DOC = "doc";
	/**
	 * csv文档
	 */
	public static final String TYPE_CSV = "csv";
	
	
	
	//纸张属性
	/**
	 * A4纸
	 */
	public static final String PAPE_STYLE_A4 = "A4";
	
	
	private static final HashMap<String,String> getContxt =new HashMap<String, String>();
	private static final HashMap<String,String> getSuffix =new HashMap<String, String>();
	private static final HashMap<String,Integer> getPapeSize =new HashMap<String, Integer>();
	
	
	public static void loadData(){
		 if (getContxt.isEmpty()){
	    	  getContxt.put(AnyFormatDocumentConstant.TYPE_XLS, 
	    			  "<?xml version=\"1.0\"?>" 																				+NEW_LINE
	    			  +"<?mso-application progid=\"Excel.Sheet\"?>" 															+NEW_LINE
	    			  +"<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" " 										+NEW_LINE
	    			  +	" 	xmlns:o=\"urn:schemas-microsoft-com:office:office\" " 												+NEW_LINE
	    			  +" 	xmlns:x=\"urn:schemas-microsoft-com:office:excel\" " 												+NEW_LINE
	    			  +"	xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" >"										+NEW_LINE
	    			  +"	<DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">"								+NEW_LINE
	    			  +"	</DocumentProperties>"																				+NEW_LINE
	    			  +"	<ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\">"									+NEW_LINE
	    			  +"		<WindowHeight>9900</WindowHeight>"																+NEW_LINE
	    			  +"		<WindowWidth>19320</WindowWidth>"																+NEW_LINE
	    			  +"		<WindowTopX>120</WindowTopX>"																	+NEW_LINE
	    			  +"		<WindowTopY>30</WindowTopY>"																	+NEW_LINE
	    			  +"		<ProtectStructure>False</ProtectStructure>"														+NEW_LINE
	    			  +"		<ProtectWindows>False</ProtectWindows>"															+NEW_LINE
	    			  +"	</ExcelWorkbook>"																					+NEW_LINE
	    			  +"	<Styles>"																							+NEW_LINE
	    			  +"		<Style ss:ID=\"Default\" ss:Name=\"Normal\">"													+NEW_LINE
	    			  +"			<Alignment ss:Vertical=\"Center\"/>"														+NEW_LINE
	    			  +"			<Borders/>"																					+NEW_LINE
	    			  +"			<Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"11\" ss:Color=\"#000000\"/>"			+NEW_LINE
	    			  +"			<Interior/>"																				+NEW_LINE
	    			  +"			<NumberFormat/>"																			+NEW_LINE
	    			  +"			<Protection/>"																				+NEW_LINE
	    			  +"		</Style>"																						+NEW_LINE
	    			  +"		<Style ss:ID=\"selfc\">"																		+NEW_LINE
	    			  +"			<Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Center\"/>"								+NEW_LINE
	    			  +"			<Borders>"																					+NEW_LINE
	    			  +"				<Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"			+NEW_LINE
	    			  +"				<Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"				+NEW_LINE
	    			  +"				<Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"			+NEW_LINE
	    			  +"				<Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"				+NEW_LINE
	    			  +"			</Borders>"																					+NEW_LINE
	    			  +"		</Style>"																						+NEW_LINE
	    			  +"		<Style ss:ID=\"selfr\">"																		+NEW_LINE
	    			  +"			<Alignment ss:Horizontal=\"Right\" ss:Vertical=\"Center\"/>"								+NEW_LINE
	    			  +"			<Borders>"																					+NEW_LINE
	    			  +"				<Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"			+NEW_LINE
	    			  +"				<Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"				+NEW_LINE
	    			  +"				<Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"			+NEW_LINE
	    			  +"				<Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"				+NEW_LINE
	    			  +"			</Borders>"																					+NEW_LINE
	    			  +"		</Style>"																						+NEW_LINE
	    			  +"		<Style ss:ID=\"header\">"																		+NEW_LINE
	    			  +"			<Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Center\"/>"								+NEW_LINE
	    			  +"			<Borders>"																					+NEW_LINE
	    			  +"				<Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"			+NEW_LINE
	    			  +"				<Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"				+NEW_LINE
	    			  +"				<Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"			+NEW_LINE
	    			  +"				<Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\"/>"				+NEW_LINE
	    			  +"			</Borders>"																					+NEW_LINE
	    			  +"			<Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"12\" ss:Bold=\"1\"/>"					+NEW_LINE
	    			  +"		</Style>"																						+NEW_LINE
	    			  +"	</Styles>"																							+NEW_LINE
	    			  +"	<Worksheet ss:Name=\"sheet1\">"																		+NEW_LINE
	    			  +"		<Table ss:ExpandedColumnCount=\"#_列数_#\"" 														+NEW_LINE
	    			  +"			ss:ExpandedRowCount=\"#_行数_#\" x:FullColumns=\"1\""										+NEW_LINE
	    			  +"			x:FullRows=\"1\" ss:DefaultColumnWidth=\"54\" ss:DefaultRowHeight=\"13.5\">"				+NEW_LINE
	    			  +"		#_表格信息$_#"																					+NEW_LINE
	    			  +"		</Table>"																						+NEW_LINE
	    			  +"		<WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\">"							+NEW_LINE
	    			  +"			<PageSetup>"																				+NEW_LINE
	    			  +"				<Header x:Margin=\"0.3\"/>"																+NEW_LINE
	    			  +"				<Footer x:Margin=\"0.3\"/>"																+NEW_LINE
	    			  +"				<PageMargins x:Bottom=\"0.75\" x:Left=\"0.7\" x:Right=\"0.7\" x:Top=\"0.75\"/>"			+NEW_LINE
	    			  +"			</PageSetup>"																				+NEW_LINE
	    			  +"			<Unsynced/>"																				+NEW_LINE
	    			  +"			<Selected/>"																				+NEW_LINE
	    			  +"			<Panes>"																					+NEW_LINE
	    			  +"				<Pane>"																					+NEW_LINE
	    			  +"					<Number>3</Number>"																	+NEW_LINE
	    			  +"					<ActiveCol>5</ActiveCol>"															+NEW_LINE
	    			  +"				</Pane>"																				+NEW_LINE
	    			  +"			</Panes>"																					+NEW_LINE
	    			  +"			<ProtectObjects>False</ProtectObjects>"														+NEW_LINE
	    			  +"			<ProtectScenarios>False</ProtectScenarios>"													+NEW_LINE
	    			  +"		</WorksheetOptions>"																			+NEW_LINE
	    			  +"	</Worksheet>"																						+NEW_LINE
	    			  +"</Workbook>"																							+NEW_LINE
	    			  );											
	    	  getContxt.put(AnyFormatDocumentConstant.TYPE_DOC, 
	    			  ""
	    			  );	         
	      }
		 if(getSuffix.isEmpty()){
			 getSuffix.put(AnyFormatDocumentConstant.TYPE_XLS, ".xls");
			 getSuffix.put(AnyFormatDocumentConstant.TYPE_DOC, ".doc");	        
			 getSuffix.put(AnyFormatDocumentConstant.TYPE_CSV, ".csv");	        
		 }
		 if(getPapeSize.isEmpty()){
			 getPapeSize.put(AnyFormatDocumentConstant.PAPE_STYLE_A4, 22000);
		 }
		
	}
	
	
	public static String getContext(String code){
		loadData();
	    return (String)getContxt.get(code);
	}
	public static String getSuffix(String code){
		loadData();
		return (String)getSuffix.get(code);
	}
	public static int getPageSize(String code){
		loadData();
		return (int)getPapeSize.get(code);
	}
	
	

}
